#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
int i=0;
void  mid(vector<string>&result,vector<string>&table,string&digits,string& temp,short t,short&size){
    if(t<size) {
        for (short i = 0; i < table[digits[t] - '0' - 2].size(); i++) {
            temp.push_back(table[digits[t] - '0' - 2][i]);
            mid(result, table, digits, temp, t + 1,size);
            if(t==size-1){
                result.push_back(temp);
            }
            temp.erase(temp.end() - 1);
        }
    }
}

vector<string> letterCombinations(string digits) {
    vector<string>table={"abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    vector<string>result;
    string temp;
    short size=digits.size();
    mid(result,table,digits,temp,0,size);
    return result;
}

int main(){
    vector<string>a=letterCombinations("23");
    for(auto temp:a){
        cout<<temp<<",";
    }

    return 0;
}